package org.tarena.dang.action.user;

import java.sql.SQLException;

import org.tarena.dang.action.BaseAction;
import org.tarena.dang.service.UserService;
import org.tarena.dang.service.UserServiceImp;

public class CheckEmailAction extends BaseAction{
	private String email;
	private boolean ok = false;
	public String execute(){
		UserService userService = new UserServiceImp();
		System.out.println(email+"  正在验证该email...");
		try {
			if(userService.findByEmail(email)){
				ok = false;
				System.out.println("  验证ok  可以使用");
			}else{
				ok = true;
				System.out.println("  验证fail  用户已存在");
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "success";
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public boolean isOk() {
		return ok;
	}
	public void setOk(boolean ok) {
		this.ok = ok;
	}
	
	
}
